package com.clstu.writer_;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

public class BufferedWriter_ {
    public static void main(String[] args) throws IOException {
//        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("D:\\ok.txt"));//覆盖的方式
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("D:\\ok.txt",true));//追加的方式
                                                             // 在于你传入的对象是覆盖方式还是追加方式
        for (int i=0;i<3;i++) {
            bufferedWriter.write("hello,I am jack Chen !!"+i);
            bufferedWriter.newLine();//根据你自己的操作系统插入一个换行
        }
        bufferedWriter.close();//调用传入对象的close()方法
    }
}
